// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement.  The various license agreements may be found at
// the Magic Software web site.  This file is subject to the license
//
// RESTRICTED USE SOURCE CODE
// http://www.magic-software.com/License/restricted.pdf

#include "MgcLight.h"

MgcImplementRTTI(MgcLight,MgcObject);
MgcImplementStream(MgcLight);

//---------------------------------------------------------------------------
MgcLight::MgcLight ()
    :
    m_kAmbient(MgcColor::BLACK),
    m_kDiffuse(MgcColor::BLACK),
    m_kSpecular(MgcColor::BLACK)
{
    m_fConstant = 1.0;
    m_fLinear = 0.0;
    m_fQuadratic = 0.0;
    m_fIntensity = 1.0;
    m_bAttenuate = false;
    m_bOn = true;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// streaming
//---------------------------------------------------------------------------
MgcObject* MgcLight::Factory (MgcStream& rkStream)
{
    // MgcLight is abstract, Factory never called
    return 0;
}
//---------------------------------------------------------------------------
void MgcLight::Load (MgcStream& rkStream, MgcStream::Link* pkLink)
{
    MgcObject::Load(rkStream,pkLink);

    // native data
    MgcStreamRead(rkStream,m_kAmbient);
    MgcStreamRead(rkStream,m_kDiffuse);
    MgcStreamRead(rkStream,m_kSpecular);
    MgcStreamRead(rkStream,m_fConstant);
    MgcStreamRead(rkStream,m_fLinear);
    MgcStreamRead(rkStream,m_fQuadratic);
    MgcStreamRead(rkStream,m_fIntensity);
    MgcStreamRead(rkStream,m_bAttenuate);
    MgcStreamRead(rkStream,m_bOn);
}
//---------------------------------------------------------------------------
void MgcLight::Link (MgcStream& rkStream, MgcStream::Link* pkLink)
{
    MgcObject::Link(rkStream,pkLink);
}
//---------------------------------------------------------------------------
bool MgcLight::Register (MgcStream& rkStream)
{
    return MgcObject::Register(rkStream);
}
//---------------------------------------------------------------------------
void MgcLight::Save (MgcStream& rkStream)
{
    MgcObject::Save(rkStream);

    // native data
    MgcStreamWrite(rkStream,m_kAmbient);
    MgcStreamWrite(rkStream,m_kDiffuse);
    MgcStreamWrite(rkStream,m_kSpecular);
    MgcStreamWrite(rkStream,m_fConstant);
    MgcStreamWrite(rkStream,m_fLinear);
    MgcStreamWrite(rkStream,m_fQuadratic);
    MgcStreamWrite(rkStream,m_fIntensity);
    MgcStreamWrite(rkStream,m_bAttenuate);
    MgcStreamWrite(rkStream,m_bOn);
}
//---------------------------------------------------------------------------
